<template>
  <div id="user">
    <div class="el_content">
      <el-row class="edit-title">
        <el-col :span="4">新增角色</el-col>
        <el-col :span="3" :push="17" class="text-right">
          <el-button
            class="back"
            type="info"
            size="mini"
            plain
            icon="el-icon-arrow-left"
            @click="goBack"
          >返回</el-button>
        </el-col>
      </el-row>
      <el-form :model="info" :rules="rules" ref="info" label-width="100px" class="el_t_20">
        <el-form-item label="角色名称：" prop="name">
          <el-row>
            <el-col :span="8">
              <el-input type="text" v-model="info.name" placeholder="请输入角色名称"></el-input>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="备注：">
          <el-row>
            <el-col :span="24">
              <el-input type="textarea" v-model="info.name" placeholder="请输入备注信息" :rows="3"></el-input>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="权限配置：" prop="name">
          <el-row>
            <el-col :span="24">
              <el-checkbox v-model="info.checked">全部</el-checkbox>
            </el-col>
            <el-col :span="24">
              <el-col :span="2" class="info-name">登记</el-col>
              <el-col :span="22">
                <el-checkbox v-model="info.checked">全部</el-checkbox>
                <el-checkbox v-model="info.checked">新增</el-checkbox>
                <el-checkbox v-model="info.checked">查看/编辑</el-checkbox>
                <el-checkbox v-model="info.checked">删除</el-checkbox>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="2" class="info-name">病例</el-col>
              <el-col :span="22">
                <el-checkbox v-model="info.checked">全部</el-checkbox>
                <el-checkbox v-model="info.checked">新增</el-checkbox>
                <el-checkbox v-model="info.checked">查看/编辑</el-checkbox>
                <el-checkbox v-model="info.checked">删除</el-checkbox>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="2" class="info-name">随访</el-col>
              <el-col :span="22">
                <el-checkbox v-model="info.checked">全部</el-checkbox>
                <el-checkbox v-model="info.checked">新增</el-checkbox>
                <el-checkbox v-model="info.checked">查看/随访</el-checkbox>
                <el-checkbox v-model="info.checked">取消随访</el-checkbox>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="2" class="info-name">模板</el-col>
              <el-col :span="22">
                <el-checkbox v-model="info.checked">全部</el-checkbox>
                <el-checkbox v-model="info.checked">新增</el-checkbox>
                <el-checkbox v-model="info.checked">查看/编辑</el-checkbox>
                <el-checkbox v-model="info.checked">删除</el-checkbox>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-col :span="2" class="info-name">设置</el-col>
              <el-col :span="22">
                <el-col :span="2">
                  <el-checkbox v-model="info.checked">全部</el-checkbox>
                </el-col>
                <el-col :span="20" style="margin-left:30px;">
                  <el-col :span="2" class="info-name">账号</el-col>
                  <el-col :span="22">
                    <el-checkbox v-model="info.checked">全部</el-checkbox>
                    <el-checkbox v-model="info.checked">新增</el-checkbox>
                    <el-checkbox v-model="info.checked">查看/编辑</el-checkbox>
                    <el-checkbox v-model="info.checked">删除</el-checkbox>
                  </el-col>
                  <el-col :span="2" class="info-name">角色</el-col>
                  <el-col :span="22">
                    <el-checkbox v-model="info.checked">全部</el-checkbox>
                    <el-checkbox v-model="info.checked">新增</el-checkbox>
                    <el-checkbox v-model="info.checked">查看/编辑</el-checkbox>
                    <el-checkbox v-model="info.checked">删除</el-checkbox>
                  </el-col>
                  <el-col :span="2" class="info-name">随访</el-col>
                  <el-col :span="22">
                    <el-checkbox v-model="info.checked">启用</el-checkbox>
                    <el-checkbox v-model="info.checked">停用</el-checkbox>
                  </el-col>
                </el-col>
              </el-col>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="状态：" prop="radio">
          <el-radio-group v-model="info.radio" size="mini">
            <el-radio-button :label="1">正常</el-radio-button>
            <el-radio-button :label="2">冻结</el-radio-button>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <el-row class="footer-fixed">
        <el-col :span="24" class="text-right">
          <el-button type="primary" plain>取 消</el-button>
          <el-button type="primary" @click="submitInfo('info')">保 存</el-button>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
export default {
  name: "user",
  data() {
    return {
      info: {
        name: "",
        radio: 1,
        sex: "",
        checked: false
      },
      rules: {
        name: [
          { required: true, message: "医嘱名称不能为空", trigger: "blur" }
        ],
        radio: [
          { required: true, message: "请选择所属分类", trigger: "change" }
        ]
      }
    };
  },
  methods: {
    submitInfo(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("验证通过！");
        } else {
          return false;
        }
      });
    },
    goBack() {
      this.$router.go(-1);
    }
  }
};
</script>
<style scoped>
.el_content {
  width: 100%;
  height: calc(100vh - 150px);
  background: #ffffff;
  padding: 20px;
}
.edit-title {
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e4e4;
  color: #006835;
  font-weight: 700;
}
.upload {
  width: 80px;
  height: 80px;
  background: #f2f2f2;
  color: #999999;
  border: 1px solid #ccc;
  text-align: center;
  border-radius: 4px;
  line-height: 1;
  padding-top: 20px;
}
.upload i {
  font-size: 18px;
}
.info-name {
  font-weight: bold;
}
</style>


